
package nc.bs.pub.action;

import nc.bs.framework.common.NCLocator;
import nccloud.bs.arap.bill.aggbusi.plugin.bpplugin.EarningHVOPluginPoint;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.pubapp.pub.rule.ApproveStatusCheckRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nccloud.itf.arap.bill.IEarninghvoMaintain;
import nc.vo.arap.earning.EarningBillVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class N_RH01_APPROVE extends AbstractPfAction<EarningBillVO> {

        public N_RH01_APPROVE() {
                super();
        }

        @Override
        protected CompareAroundProcesser<EarningBillVO> getCompareAroundProcesserWithRules(
                        Object userObj) {
                CompareAroundProcesser<EarningBillVO> processor = new CompareAroundProcesser<EarningBillVO>(
                                EarningHVOPluginPoint.APPROVE);
                processor.addBeforeRule(new ApproveStatusCheckRule());
                return processor;
        }

        @Override
        protected EarningBillVO[] processBP(Object userObj,
                        EarningBillVO[] clientFullVOs, EarningBillVO[] originBills) {
                EarningBillVO[] bills = null;
                IEarninghvoMaintain operator = NCLocator.getInstance().lookup(
                                IEarninghvoMaintain.class);
                try {
                        bills = operator.approve(clientFullVOs, originBills);
                } catch (BusinessException e) {
                        ExceptionUtils.wrappBusinessException(e.getMessage());
                }
                return bills;
        }

}
